<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('offering')} > ${i18n.getMessage('opinion')} > Add Absence">
	<a href="#" onclick="cc('offering/showListOpinion.sgt?offeringId=${(offeringId)!}')">${i18n.getMessage('opinion')}</a>
	- <a href="#" onclick="cc('offering/showInfoOffering.sgt?id=${(offeringId)!}')">${i18n.getMessage('offering')}</a>
</@showTitle>

<div id="error" style="display:none"></div>

<form action="offering/addAbsence.sgt" validator="offering/validateAbsence.sgt" onsubmit="submitFormValidation(this); return false;" onreset="$('error').hide()">
	<input type="hidden" name="offeringId" value="${offeringId}"/>
	<table id="dataTable" align="center" cellspacing="5" cellpadding="0">
		<tr>
			<td class="name"><@required/>${i18n.getMessage('student')}:</td>
			<td>
				<select name="memberId" style="width:205px">
					<option></option>
					<#list members as member>
						<option value=${(member.id)!}>${(member.receipt.student.fullName)!}</option>
					</#list>
				</select>
			</td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('absence.days')}:</td>
			<td><input type="text" name="numOfAbsentDays" maxlength="2" style="text-align:right;width:200px" onblur="updateLate(this)" onkeyup="data_change(this)"/></td>
		</tr>
		<tr>
			<td class="name"><@required/>${i18n.getMessage('absence.contactingDate')}:</td>
			<td><input type="text" name="contactingDate" value="${now?date}" style="width:200px"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(document.forms[0].contactingDate, '${i18n.getMessage('format.date')}', this)"/></td>
		</tr>
		<tr>
			<td class="name" style="vertical-align:top"><@required/>${i18n.getMessage('reason')}:</td>
			<td><textarea name="reason" style="width:350px;height:80px;"></textarea></td>
		</tr>
		<tr>
			<td class="name"></td>
			<td>
				<input type="submit" value="${i18n.getMessage('add')}" class="button_style"/> 
				<input type="reset" value="${i18n.getMessage('reset')}" class="button_style"/> 
			</td>
		</tr>
	</table>
</form>

<script>
data_change = function(field) {
    var value = field.value;
	for(var i=0;i < field.value.length; ++i) {
		var new_key = value.charAt(i);
        if(((new_key < "0") || (new_key > "9")) && !(new_key == "")) {
			field.value = "";
            break;
		}
	}
}
</script>